var ec_mid1 = echarts.init(document.getElementById('mid1'), "dark");

ec_m1_option = {
  text:[m1x=[]],      //由于盒须图的x轴无法直接使用字符串，所以这里创建一个储存科室名称的对象，随后通过引用这个对象将科室名称放入x轴中
  toolbox: {
    show: true,
    itemSize:18,
    itemGap:12,
    feature: {
      dataView: { show: true, readOnly: false },
      dataZoom: { show: true },
      restore: { show: true },
      saveAsImage: { show: true }
    },
    right:"10%"
  },
  title: [
    {
      text: '图片诊断价格盒须图',
      left: 'center'
    },
    {
      borderColor: '#999',
      borderWidth: 1,
      textStyle: {
        fontWeight: 'normal',
        fontSize: 14,
        lineHeight: 20
      },
      left: '10%',
      top: '90%'
    }
  ],
  dataset: [
    {
      source: []    //获取到的数据将在被处理好后填充到这个对象中，从而显示数据
    },
    {
      transform: {
        type: 'boxplot',
        config: { itemNameFormatter: function (params){
          return ""+ec_m1_option.text[0].m1x[parseInt(params.value)];   //引用前面储存科室名称的对象，从而在x轴显示各个科室
          }
        }
      }
    },
    {
      fromDatasetIndex: 1,
      fromTransformResult: 1
    }
  ],
  tooltip: {
    trigger: 'item',
    axisPointer: {
      type: 'shadow'
    }
  },
  grid: {
    left: '10%',
    right: '10%',
    bottom: '15%'
  },
  xAxis: {
    type: 'category',
    boundaryGap: true,
    nameGap: 30,
    splitArea: {
      show: false
    },
    axisLabel: {
      interval: 0,
      rotate:340
    },
    splitLine: {
      show: false
    }
  },
  yAxis: {
    type: 'value',
    splitArea: {
      show: true
    }
  },
  series: [
    {
      name: 'boxplot',
      type: 'boxplot',
      datasetIndex: 1
    },
    {
      name: 'outlier',
      type: 'scatter',
      datasetIndex: 2
    }
  ]
};

ec_mid1.setOption(ec_m1_option);